#ifndef _PIGOS_PROCESS_H_
#define _PIGOS_PROCESS_H_

#include <type.h>
#include "protect.h"
#include "fs.h"

#define NUM_OPENFILE	8
struct process {
	int		pid;
	int		father;

	int		status;
	int		wait_pid;

	struct tss	tss;
	struct ldt	ldt;

	u16_t		tss_selector;
	u16_t		ldt_selector;

	u32_t		work_dir;
	struct openfile	openf[NUM_OPENFILE];

	u32_t		alarm;

	struct process	*prev, *next;
	struct process	*wait_head, *wait_next;
};


extern struct process *current;

void first_proc(void *func);
int getpid(void);
int getppid(void);
void pause(void);
void wake_up(int pid);
void do_exit(void);
int wait(int *retval);
int wait_pid(int pid, int *retval, int block);
void wait_for(struct process **head);
void wake_wait(struct process **head);

#endif
